package com.mylims.ifdc.home.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hanky
 * @date 2025/9/23
 */
@RestController
public class HomeController {
    private Logger logger = LogManager.getLogger(HomeController.class);

    @Autowired
    private SimpMessagingTemplate messagingTemplate;

    @RequestMapping("/")
    public String home() {
        messagingTemplate.convertAndSend("/topic/logs", "xxxxxxxxxxxxxxxxx");
        new Thread(() -> {
            while (true){
                logger.info(">>>>>> home : hhhhhhha");
                try {
                    Thread.sleep(2000);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();

        return "hahahaha";
    }
}
